import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
export class CreateMenuDto {
  // id: number;
  @ApiProperty({ description: '父级菜单' })
  @Type(() => Number) // 👈 自动把字符串转换成 number
  parentId: number = 0;

  @ApiProperty({ description: '路由路径' })
  routePath?: string = '';

  @ApiProperty({ description: '路由名称' })
  routeName?: string = '';

  @ApiProperty({ description: '路由组件路径' })
  component?: string = '';

  @ApiProperty({ description: '重定向' })
  redirect?: string = '';

  @ApiProperty({ description: '菜单类型、(1:目录; 2:菜单; 3:按钮; 4:外链)' })
  @Type(() => Number) // 👈 自动把字符串转换成 number
  type: number = 1;

  @ApiProperty({ description: '菜单名称' })
  name: string = '';

  @ApiProperty({ description: '路由图标' })
  icon?: string = '';

  @ApiProperty({ description: '显示状态、(0:隐藏;1:显示)' })
  @Type(() => Number) // 👈 自动把字符串转换成 number
  visible?: number;

  @ApiProperty({ description: '路由缓存、(0:关闭缓存;1:开启缓存)' })
  @Type(() => Number) // 👈 自动把字符串转换成 number
  keepAlive?: number = 1;

  @ApiProperty({ description: '排序' })
  @Type(() => Number) // 👈 自动把字符串转换成 number
  sort?: number = 0;

  @ApiProperty({ description: '权限标识' })
  perm?: string = '';
}
